package com.cqhfan.pojo.im.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cqhfan.core.enums.ChatTypeEnum;
import com.cqhfan.core.enums.MessageTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author 眭传洪
 * @create 2025-08-16 1:36
 */
@Data
@TableName("im_message")
public class ImMessage implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    // 发送者
    private Long senderId;

    // 接收者
    private Long receiverId;

    // 消息内容
    private String content;

    // 消息类型
    private MessageTypeEnum messageType;

    // 聊天类型
    private ChatTypeEnum chatType;

    // 群id
    private Long groupId;

    // 语音时长
    private Integer voiceDuration;

    // 语音地址
    private String voiceUrl;

    // 是否已读
    private Boolean ifRead;

    // 聊天时间
    private String chatTime;

    // 聊天列表id
    @JsonSerialize(using = ToStringSerializer.class)
    private Long chatListId;

    private LocalDateTime createTime;

}
